<script setup lang="ts">
import {ChatRoleApi, ChatRoleVO} from "@/api/ai/model/chatRole";

const aiRoles=ref<ChatRoleVO[]>([])
const props = defineProps({
  modelValue:{
    type:Number,
    required:false,
  }
});
const emits = defineEmits<{
  (e:'update:modelValue',value:number):void
}>();
const handUpdate=(v:number)=>{
  console.log('handUpdate',v)
  emits("update:modelValue",v)
}
onMounted(()=>{
  ChatRoleApi.getChatRolePage({pageSize:100,publicStatus:true}).then((res) => {
    aiRoles.value = res.list;
  })
})
</script>

<template>
  <el-select :model-value="props.modelValue" @update:model-value="handUpdate">
    <el-option v-for="r in aiRoles" :key="r.id" :value="r.id" :label="r.name" />
  </el-select>
</template>

<style scoped lang="scss">

</style>
